home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_2 / fifolib / handler.h < prev    next >
C/C++ Source or Header  |  1991-12-06  |  2KB  |  92 lines

  1.  
  2. /*
  3.  *  HANDLER.H
  4.  */
  5.  
  6. #include <exec/types.h>
  7. #include <exec/nodes.h>
  8. #include <exec/ports.h>
  9. #include <exec/interrupts.h>
  10. #include <exec/memory.h>
  11. #include <exec/alerts.h>
  12. #include <dos/dos.h>
  13. #include <dos/dosextens.h>
  14. #include <dos/filehandler.h>
  15. #include <clib/dos_protos.h>
  16. #include <clib/exec_protos.h>
  17. #include <clib/alib_protos.h>
  18.  
  19. #include <stdio.h>
  20. #include <stdarg.h>
  21. #include <stdlib.h>
  22. #include <lib/requestfh.h>
  23.  
  24. #define Prototype extern
  25.  
  26. #define DOS_TRUE    -1
  27. #define DOS_FALSE   0
  28.  
  29. #define CB_SIZE     1024    /*  lines buffer */
  30.  
  31. #define BTOC(bptr)  ((void *)((long)(bptr) << 2))
  32. #define CTOB(cptr)  ((BPTR)(((long)cptr) >> 2))
  33.  
  34. typedef struct DosPacket    DosPacket;
  35. typedef struct FileHandle   FileHandle;
  36. typedef struct DeviceNode   DeviceNode;
  37. typedef struct Process        Process;
  38. typedef struct MinNode        Node;
  39. typedef struct MinList        List;
  40. typedef struct Node        MaxNode;
  41. typedef struct List        MaxList;
  42. typedef struct MsgPort        MsgPort;
  43. typedef struct Message        Message;
  44. typedef struct Interrupt    Interrupt;
  45. typedef struct DosList        DosList;
  46. typedef struct RootNode     RootNode;
  47. typedef struct DosInfo        DosInfo;
  48.  
  49. typedef struct SharRead {
  50.     void    *sr_FifoR;
  51.     long    sr_Refs;
  52. } SharRead;
  53.  
  54. typedef struct FHan {
  55.     MaxNode    ff_Node;    /*    fifo node   */
  56.     short    ff_Flags;
  57.     short    ff_Refs;    /*    open refs   */
  58.     SharRead    *ff_SRead;  /*    fifo handle for reading */
  59.     void    *ff_FifoW;  /*    fifo handle for writing */
  60.     long    ff_FBufSiz; /*    FifoW buffer size    */
  61.     Message    ff_RdMsg;
  62.     Message    ff_WrMsg;
  63.     MsgPort    *ff_Port;   /*    unique port for messages    */
  64.     List    ff_RdWait;
  65.     List    ff_WrWait;
  66.     char    *ff_CookBuf;/*    cooked buffer handling        */
  67.     short    ff_CookIdx;
  68.     short    ff_LRet;
  69.     void    *ff_Task;
  70. } FHan;
  71.  
  72. #define ff_FifoR    ff_SRead->sr_FifoR
  73.  
  74. #define FHF_COOKED    0x0001
  75. #define FHF_RPEND    0x0002
  76. #define FHF_WAVAIL    0x0004
  77. #define FHF_READ    0x0008
  78. #define FHF_WRITE    0x0010
  79. #define FHF_CLOSEEOF    0x0020
  80. #define FHF_MASTER    0x0040
  81. #define FHF_TEE     0x0080
  82. #define FHF_SHELL    0x0100
  83. #define FHF_COOKBFUL    0x0200        /*    cooked buffer is full    */
  84. #define FHF_COOKECHOBLK 0x0400        /*    blocked echoing chars!    */
  85. #define FHF_REOF    0x0800        /*    REMOTE EOF        */
  86. #define FHF_WIHOLD    0x1000        /*    write hold due to input */
  87. #define FHF_COOKCRLF    0x2000        /*    need to write CRLF    */
  88. #define FHF_RREQUIRED    0x4000
  89.  
  90. #include "fifohan-protos.h"
  91.  
  92.